#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int nums[100];
	char s;
	int i = 0;
	while (1)
	{
		cin >> s;
		if (s == '[' || s == ',')
		{
			cin >> nums[i];
			i++;
		}
		else if (s == ']')
		{
			break;
		}
	}
	int min = *min_element(nums, nums + i);
	int max = *max_element(nums, nums + i);

	int sum = 0;
	for (int j = 0;j < i;j++)
	{
		if(nums[j]!=min&&nums[j]!=max)
		//if (nums[j] > min && nums[j] < max)
		{
			sum++;
		}
	}

	cout << sum;
	return 0;
}